This application claims the priority benefit of Taiwan application serial no. 87114055, filed Aug. 26, 1998, the full disclosure of which is incorporated herein by reference.
1. Field of Invention
The present invention generally relates to a power management method for a computer system, and more particularly to a method for suspending, resuming, and turning on a computer system without being affected by an abnormal power failure.
2. Description of Related Art
With the advancement of information technology, computers play an important role in the day-to-day life in this modern society. FIG. 1 shows a block diagram of a conventional computer system 100, which comprises a central processing unit (CPU) 110, a chipset 120, a memory 130, a storage device 140, an interface device 160, and a power supply 150. The CPU 110 is the heart of the computer system 100, responsible for executing programs in the computer system 100. The chipset 120 is used to control the communication between other devices within the computer system 100 and the CPU 110. The memory 130, typically dynamic random access memory (DRAM) because of its high speed and low cost, is used for storing programs and data for the computer system 100. The storage device 140 generally has a large capacity for storing data in a longer period, such as a hard disk drive or a compact disc drive, etc. The interface device 160 connected to other peripheral devices is used as an interface for users to access the computer system 100, including keyboard, mouse, or printer interface, etc. As shown in FIG. 1, the interface device 160 including a MODEM 161 connected to a telephone line and a network adapter 162 connected to a network is depicted. The power supply 150 is used to convert an external AC power source into DC voltages, for example, +5V, xe2x88x925V, +12V, or xe2x88x9212V, etc, required by various circuits within the computer system 100. For a power supply complying with the newly developed ATX specifications, the output from the power supply comprises a main power and a standby power. When the computer system 100 is in normal operation, the main power provides power for the whole computer system 100. When the computer system 100 is turned off, the standby power provides power required by some special devices to perform special functions, for example, remote wakeup, keyboard wakeup, or the sleep-state functions which will be described in details hereinafter.
With the advancement in hardware and software of a computer system, an advanced configuration and power interface (ACPI) specification has been developed to provide more functions in power management for the computer system. There are 5 different levels of sleep states, i.e., S1xcx9cS5, defined in the ACPI specification. The S1 and S2 sleep states are also called xe2x80x9cpower on suspendxe2x80x9d, which means the main power is still provided by the power supply although the system is in a suspending state. The S3 sleep state is called xe2x80x9csuspend to RAM (STR)xe2x80x9d, which means relevant operating information and context of related devices are saved in a memory before the main power is turned off. Nevertheless, the standby power still provides power to the memory and its related circuits, so that relevant operating information and context of related devices can be saved in the memory. The S4 sleep state is called xe2x80x9csuspend to disk (STD)xe2x80x9d, which means relevant operating information and context of related devices are saved in a hard disk before the main power is turned off. There is no need for the standby power to provide power to the memory and its related circuits. The S5 sleep state generally refers to a xe2x80x9csoft offxe2x80x9d state for the computer system.
Reference is now made to FIG. 2, where a flow chart showing a conventional computer system entering into a sleep state or soft-off state is depicted. FIG. 3 is a flow chart showing a conventional computer system resuming to a normal operation state from a sleep state or soft-off state. As shown in FIG. 2, when a suspending or soft-off instruction is received, the computer system determines the instruction category first (Step 21). If a STR instruction is received, relevant operating information and context of related devices are saved into a memory (Step 22). The computer system enters into the S3 sleep state (Step 23) by turning off the main power, while maintaining the standby power to provide power to the memory and its related circuits to save relevant operating information in the memory. If a STD instruction is received in Step 21, relevant operating information and context of related devices are saved into a hard disk (Step 24). The computer system enters into the S4 sleep state (Step 25) by turning off the main power. If a soft-off instruction is received in Step 21, a normal turn-off procedure is performed to close all the application programs. The computer system then enters into the soft-off state (Step 27).
Reference is now made to FIG. 3, where a flow chart of a conventional computer system resuming to a normal operation state from a sleep state or soft-off state is depicted. As shown in FIG. 3, when a wake-up instruction, for example, a resuming or turn-on instruction, is received, the computer system checks up the current system state first (Step 31). If the computer system is in the S3 or STR sleep state, a STR resuming procedure is performed (Step 32). That is, relevant operating information and context of related devices saved in the memory are restored to resume the system to its original operating state. Subsequently, the computer system enters the normal operation state (Step 33). If the computer system is found in the S4 or STD sleep state in Step 31, a STD resuming procedure is performed (Step 34) so that relevant operating information and context of related devices saved in a hard disk are restored to resume the system to its original state. Subsequently, the computer system enters the normal operation state (Step 33). If the computer system is found in the soft-off state in Step 31, a normal turn-on procedure is performed (Step 36). The computer system enters the normal operation state (Step 33).
When the computer system is in the S3 or STR sleep state, the computer system can resume to its original operating state in a few seconds. Furthermore, only a portion of the power source, typically less than 5W, is required for the memory and its related circuits to store relevant operating information in the memory while in S3 state. Compared with a power consumption of 60Wxcx9c70W in the normal operation state, the S3 sleep state possesses a significant advantage. As for the S4 or STD sleep state where relevant operating information are stored in the hard disk, the time frame required is much longer for the system to resume to its original operating state, because a larger accessing time to the hard disk is required. It is therefore apparent that the S3 is an ideal choice as the sleep state because the computer system not only consumes less power, but also meets requirements of the xe2x80x9con-now systemxe2x80x9d.
However, there is a risk if the computer system is in the S3 or STR sleep state. That is, if the external power source is suddenly cut off, the standby power is also cut off. The relevant operating information and context of related devices saved in the memory will be totally lost. The computer system can no longer resumes to its original operating state under this circumstance. The loss of saved data in the memory also causes significant damages to the users.
As mentioned earlier, the power supply provides a main power and a standby power to the computer system. When the main power is turned off, the standby power still provides power to several special devices to perform specific functions. For example, xe2x80x9cwake on local area network (LAN)xe2x80x9d or xe2x80x9cring in wake upxe2x80x9d functions to turn on the computer system, in addition to the S3 sleep state function mentioned earlier, are some of the examples which require the standby power. The xe2x80x9cwake on LANxe2x80x9d function is used to wake up a local computer system from a remote computer via a network. The xe2x80x9cring in wake upxe2x80x9d function is used to wake up a computer system having a MODEM connected to a telephone line when a telephone rings. For computer systems having a MODEM 161 or a network adapter 162 as shown in FIG. 1, the objective to turn on the computer system mentioned earlier can be achieved. However, these special turn-on functions are closely related to status registers within the chipset generally including North bridge and South bridge of the computer system, which store relevant information for these functions. These special turn-on functions can only be activated if the computer system is turned off in a normal way. If there is any sudden power failure, these special turn-on functions can not be activated. Therefore, the computer system can not be turned on if power resumes after a sudden power failure. This causes inconvenience for users as well as system administrators to manage the computer system.
As a summary, the power management in a conventional computer system has the following disadvantages:
1. According to the ACPI specification, when the computer system is in the S3 sleep state where relevant operating information of the computer system are saved in the memory, the main power can be turned off while the standby power provides power required by the memory and its related circuits. In this case, the power consumption is significantly reduced. If the computer system is to be used, it can be quickly resumed to the original operating state, which is very convenient. However, if there is any abnormal power failure, the information stored in the memory will be lost and damages will be unavoidable for the users.
2. Although computer systems complying with the ATX specifications can support the xe2x80x9cwake on LANxe2x80x9d function and the xe2x80x9cring in wake upxe2x80x9d function, these functions are activated only when the computer system is turned off in a normal way. If there is any abnormal power failure, the turn-on functions can no longer be used. Therefore, the users or system administrator can not wake up a local computer system from a remote site or wake up a remote computer system from a local site when power resumes once the abnormal power failure had occurred, which causes great inconvenience.
It is therefore an objective of the present invention to provide a method for suspending and resuming a computer system without being affected by an abnormal power failure. Relevant operating information and context of the related devices are stored in both a memory and a hard disk before the computer system enters the S3 sleep state. If there is any power failure occurred, relevant operating information of the system can still be fetched from the hard disk so that the computer system can resume to its original operating state even if the information saved in the memory is lost.
It is another objective of the present invention to provide a method for turning on a computer system without being affected by an abnormal power failure, with which the computer system can self turn on and activate special turn-on functions when power resumes after a sudden power failure. Subsequently, the computer system enters the soft-off state. Users and system administrator can wake up the computer system from a remote side by the xe2x80x9cwake on LANxe2x80x9d function or the xe2x80x9cring in wake upxe2x80x9d function.
In accordance with the foregoing and other objectives of the present invention, a method for suspending a computer system without being affected by an abnormal power failure is provided. An instruction is received. The instruction is categorized. A normal turn-off procedure is performed so that the computer system enters into a soft-off state if a soft-off instruction is received. Relevant operating information and context of related devices are saved into both a memory and a hard disk in the computer system if the instruction received is determined to be either a STR or STD instruction. The instruction is re-categorized. The computer system enters into an S3 sleep state if the instruction received is a STR instruction. The computer system enters into an S4 sleep state if the instruction received is a STD instruction.
Accordingly, the method for resuming a computer system comprises the following steps. A wake up instruction is received, wherein the wake up instruction comprises a resuming instruction and a turn-on instruction. A current state of the computer system is determined. A normal turn-on procedure is performed to enter the computer system into a normal operation state if the current state of the computer system is neither in the STR sleep state nor in the STD sleep state. A STD resuming procedure is performed by restoring the relevant operating information and context of related devices from a hard disk to enter the computer system into a normal operation state if the computer system is in the STD sleep state. Whether there is any abnormal power failure occurred if the computer system is in the STR sleep state is determined. The STD resuming procedure is performed by restoring relevant operating information and context of related devices from the hard disk to enter the computer system into a normal operation state if the computer system is in the STR sleep state and an abnormal power failure had occurred. A STR resuming procedure is performed by restoring relevant operating information and context of related devices from a memory to enter the computer system into a normal operation state if the computer system is in the STR sleep state and no abnormal power failure had occurred.
In addition, the method for turning on a computer system without being affected by an abnormal power failure is provided. First, there is a register to memorize if an AC power failure happened. Secondly, there is an xe2x80x9cAC power failure restartxe2x80x9d option in the basic input and output system (BIOS) setup menu that users can select to restart the system or keep the previous state after power resumes if an AC power failure had happened. Thirdly, the system will turn itself on when power resumes after the AC power failure. The whole procedure is as follows:
When the system turns on (no matter by itself or by the users), it will check the register if an AC power failure happened. If there is no AC power failure happened, the system will boot directly to the operating system (OS) according to a normal booting sequence.
If an AC power failure did happen, it will first check the xe2x80x9cAC power failure restartxe2x80x9d option in the BIOS setup menu. If the information saved in the register is xe2x80x9crestartxe2x80x9d or xe2x80x9ckeep the previous statusxe2x80x9d and the previous status is xe2x80x9cONxe2x80x9d, the system will boot directly to the OS. If the information saved in the register is xe2x80x9cno restart requiredxe2x80x9d or xe2x80x9ckeep the previous statusxe2x80x9d and the previous status is xe2x80x9cOFFxe2x80x9d, the system will activate the xe2x80x9cWake on LANxe2x80x9d and xe2x80x9cRing in wake upxe2x80x9d functions in the chipset and related devices to enter the system into the soft off state.
Based on the above-mentioned procedures, the method for resuming and turning on a computer system comprises the following steps. A wake up instruction is received, wherein the wake up instruction comprises a resuming instruction and a turn-on instruction. Whether there is any abnormal power failure happened is determined. A xe2x80x9cwake on LANxe2x80x9d function and a xe2x80x9cring in wake upxe2x80x9d function are activated if there is an abnormal power failure happened to computer system. The current state of the computer system is determined. The current state of the computer system into a STD sleep state is changed while the computer system is in the STR sleep state and an abnormal power failure had occurred. The computer system is entering into the STD sleep state. The computer system is entering into the STD sleep state if the computer system is in the STD sleep state and an abnormal power failure had occurred. The computer system is entering into a soft-off state if the computer system is neither in the STR sleep state nor in the STD sleep state and an abnormal power failure had occurred. The current state of the computer system is determined if no abnormal power failure happened to computer system. A STR resuming procedure is performed if the computer system is in the STR sleep state and no abnormal power failure happened to computer system. A STD resuming procedure is performed if the computer system is in the STD sleep state and no abnormal power failure happened to computer system. A normal turn-on procedure is performed if the computer system is in the soft-off state and no abnormal power failure happened to computer system. The computer system is entering into a normal operation state.
It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the invention as claimed.